package com.braveman.im.ui.adapter;

import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;

import com.braveman.im.R;
import com.braveman.im.bean.DataListBean;
import com.braveman.im.bean.GroupListBean;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.qmuiteam.qmui.widget.QMUIRadiusImageView;

import java.util.List;

/**
 * 作者：qu zhao xin
 * 邮箱：qu15264880529@163.com
 * 手机号：15264880529
 * 时间：17/10/28 10:35
 */

public class SendLoveAdapter extends BaseQuickAdapter<DataListBean, BaseViewHolder> {
    private TextView mIvItemCompanyCheckInfo;
    private QMUIRadiusImageView qmuiRadiusImageView;

    public SendLoveAdapter(@LayoutRes int layoutResId, @Nullable List<DataListBean> data) {
        super(R.layout.item_love_ad_list, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, DataListBean item) {
        qmuiRadiusImageView = helper.getView(R.id.iv_item_company_check_head_icon);
        qmuiRadiusImageView.setCircle(false);
        helper.setText(R.id.tv_item_send_love_time, item.publishTime).
                setText(R.id.tv_item_contact_name, "受助者： " + item.contactName).
                setText(R.id.tv_item_contact_details, item.detail).addOnClickListener(R.id.tv_phone_icon);
        mIvItemCompanyCheckInfo = helper.getView(R.id.iv_item_company_check_info);
        mIvItemCompanyCheckInfo.setText(item.subject);
        if (item.ifVerified) {
            mIvItemCompanyCheckInfo.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.mipmap.message_love_list_icon_verify, 0);
        } else {
            mIvItemCompanyCheckInfo.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
        }
        Glide.with(mContext).load(item.publisherAvatar).into(qmuiRadiusImageView);
    }
}
